
#pragma once

#include <stddef.h>
#include "ql.h"

/*
 * interface
 */

size_t list_length( List * list );

/*
 * clones list, elements within list will not be cloned
 */
List * list_clone( AllocContext * c, List * list );

/*
 * checks that all the objects within the list given has the specified type
 */
bool list_check_elements_type( List * list, int type );

void list_push( AllocContext * c, struct List * list, Obj * elem );

Obj * list_set_at( List * list, size_t pos, Obj * elem );

/*
 * appends list's contents to result
 */
void list_append( List * result, List * list );

/*
 * pop list contents, frees cdr, if any
 */
struct Obj * list_pop( AllocContext * c, List * list );

void list_add( AllocContext * c, List * list, Obj * elem );

struct Obj * list_at( List * list, size_t pos );

struct List * list_reverse( AllocContext * c, List * list );
